package com.xuecheng.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuecheng.commons.model.vo.CompanyVo;
import com.xuecheng.commons.model.vo.ResponseResult;
import com.xuecheng.commons.utils.AuthInfoHolder;
import com.xuecheng.commons.utils.BeanHelper;
import com.xuecheng.system.domain.Company;
import com.xuecheng.system.mappers.CompanyMapper;
import com.xuecheng.system.service.CompanyService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 教育机构 服务实现类
 * </p>
 *
 * @author itheima
 * @since 2022-07-16
 */
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
    @Override
    public ResponseResult mine() {
        //1.通过ThreadLocal获取企业id，获取企业信息
        Company company = this.getById(AuthInfoHolder.getCompanyId());
        //2.封装Vo返回对象
        CompanyVo companyVo = BeanHelper.copyProperties(company, CompanyVo.class);
        //3.返回
        return ResponseResult.okResult(companyVo);
    }
}
